Skip to content

Phase 3B baseline replacement plan — supersedes PR #248 (docs only)#250

Open
mdtazizulislam wants to merge 1 commit into
mainfrom
docs/phase3b-baseline-replacement
Open

Phase 3B baseline replacement plan — supersedes PR #248 (docs only)#250
mdtazizulislam wants to merge 1 commit into
mainfrom
docs/phase3b-baseline-replacement

Conversation

@mdtazizulislam

Copy link
Copy Markdown
Owner

Summary

B3 PG18 verification proved PR #248's initDatabase()-derived baseline is not faithful to production. This package documents the confirmed drift and the plan to regenerate the authoritative 0000_prod_baseline from the operator's real Gate 1 snapshot on PG18. Docs only — no production deploy, migration execution, schema application, backend wiring, or feature-flag activation. PR #248 stays unmerged and is superseded.

Confirmed drift (apples-to-apples, same catalog queries, throwaway PG16)

Metric PR #248 (initDatabase()) Real prod (Gate 1 / PG18) Delta
Tables 125 125 0 ✅
Columns 1595 1649 +54 (real)
Indexes 400 402 +2
FKs 267 266 −1

Applying all 24 hand-written migration .sql files on top of initDatabase() moved columns only 1595 → 1596. So ~53 production columns (+2 indexes, −1 FK) exist in no source of truth — undocumented production drift (the core Phase-3 problem). The earlier "measurement artifact?" question is settled: measured identically, the gap is real.

Consequence

Deliverables

  • 01_DRIFT_FINDING.md — full evidence (apples-to-apples counts + the migration test).
  • 02_REPLACEMENT_RUNBOOK.md — operator steps on PG18: regenerate from the real snapshot → fix the int4_ops artifact → normalized structural diff (captures the ~54-column drift inventory) → build journal → prove seeded db:migrate skips with zero DDL (the step B3 blocked) → commit to this replacement PR.

Next / decision

Operator runs the replacement runbook on PG18. On PASS, the snapshot-derived baseline supersedes PR #248 (close #248 in its favor), B3 clears, and B2 (restore/PITR) is next — all separately approved. The drift inventory from the diff also feeds Phase 3C convergence.

Guardrails honored

🤖 Generated with Claude Code


Generated by Claude Code

B3 PG18 verification proved PR #248's initDatabase()-derived baseline is
unfaithful to production. Apples-to-apples catalog counts (throwaway PG16):
initDatabase() = 125 tables / 1595 cols / 400 idx / 267 fk; real prod
(operator PG18/Gate 1 snapshot) = 125 / 1649 / 402 / 266. Applying all 24
hand-written migration .sql files on top of initDatabase() moved columns
only 1595->1596 — so ~53 prod columns (+2 indexes, -1 FK) exist in NO
source of truth = undocumented production drift.

Consequence: PR #248 baseline superseded. The authoritative 0000_prod_baseline
must be introspected from the REAL Gate 1 snapshot (operator, PG18), not
initDatabase().

Deliverables: 01_DRIFT_FINDING.md (evidence), 02_REPLACEMENT_RUNBOOK.md
(operator regenerate on PG18 + normalized diff / drift inventory + journal +
seeded db:migrate zero-DDL proof + commit to replacement PR). Diagnostics ran
on throwaway PG16 (torn down); production untouched; PR #248 stays unmerged.

No production deploy/migration execution/schema application/backend wiring/
feature-flag activation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MiPyhqoV9Pt7XN2tiFpS4A
@netlify

netlify Bot commented Jul 6, 2026

Copy link
Copy Markdown

Deploy Preview for zonforge-customer-operations canceled.

Name Link
🔨 Latest commit 5e8943e
🔍 Latest deploy log https://app.netlify.com/projects/zonforge-customer-operations/deploys/6a4bfaf87ba84e0008944ff1

@netlify

netlify Bot commented Jul 6, 2026

Copy link
Copy Markdown

Deploy Preview for ai-powered-cyber ready!

Name Link
🔨 Latest commit 5e8943e
🔍 Latest deploy log https://app.netlify.com/projects/ai-powered-cyber/deploys/6a4bfaf83da1fc0008413e5e
😎 Deploy Preview https://deploy-preview-250--ai-powered-cyber.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 98 (🟢 up 2 from production)
Accessibility: 99 (no change from production)
Best Practices: 92 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

mdtazizulislam pushed a commit that referenced this pull request Jul 8, 2026
…fication

Evidence-based verification of the P1 baseline chain on a throwaway local
PostgreSQL 16 cluster (created and destroyed in-session; production never
touched):

- PR #250's drift finding independently corroborated: PR #248's
  initDatabase()-derived candidate re-materialized and counted with the
  operator's exact catalog queries — 125 tables / 1595 columns / 400
  indexes / 275 non-PK / 267 FKs, matching the drift table exactly and
  confirming the ~54-column shortfall vs production (1649).
- Guard checks on main: db:migrate inert (no meta/_journal.json — migrate.ts
  skips), no prod-baseline directory merged, baseline-preview quarantined,
  initDatabase() still the runtime schema source (the drift engine).
- New finding feeding back into PR #250's runbook: the Step 2 artifact fix
  (grep int4_ops) is too narrow — 149 wrong-opclass tokens exist in at
  least three forms, including text_ops-on-timestamptz which hard-fails on
  apply (reproduced); amendment: normalize ALL explicit opclass tokens.
- Hard gates documented: the Gate 1 production snapshot is operator-held
  (no dump in-tree) and PG18 requires Docker (no daemon here) — so the
  final authoritative baseline is operator-executed per the amended
  runbook; fabricating it from in-repo sources is explicitly not done.
- Verdict + exact remaining path: merge PR #250, close PR #248 as
  superseded, operator runs the amended runbook, commit the 1649-column
  authoritative baseline; then P2.

Docs only — no code changes, no migrations, no schema changes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MMnfvQvtgNQwiUvPJ4ff8Z
mdtazizulislam added a commit that referenced this pull request Jul 8, 2026
…fication (#279)

Production Readiness P1: evidence-based verification of the authoritative
database baseline plan. Docs-only — adds
docs/audit/production-readiness/P1_AUTHORITATIVE_BASELINE.md (132 lines).

- Independently corroborated PR #250's drift finding: PR #248's
  initDatabase()-derived candidate re-materialized on a throwaway
  PostgreSQL 16.13 cluster reproduces every candidate-side count exactly
  (125 tables / 1595 columns / 400 indexes / 275 non-PK / 267 FKs) vs
  real production's 1649 columns — the candidate must never be adopted.
- New finding (runbook amendment): the replacement runbook's opclass fix
  step is too narrow — 149 wrong-opclass tokens in three forms, including
  text_ops on timestamptz which hard-fails on apply; amendment: normalize
  ALL <type>_ops tokens.
- Guard verification on main: no live migration journal (db:migrate inert),
  no prod-baseline directory, baseline-preview quarantined, initDatabase()
  drift engine documented.
- Final baseline generation remains operator-gated (Gate 1 snapshot +
  PG18); no baseline adopted, no schema changes, no code changes.
- Throwaway cluster destroyed and verified.
mdtazizulislam pushed a commit that referenced this pull request Jul 8, 2026
Evidence-based PG18 verification, executed on a genuine PostgreSQL 18.4
server obtained without Docker (npm @embedded-postgres/linux-x64).
Docs-only: adds docs/audit/production-readiness/P2_PG18_VERIFICATION.md.

- Candidate baseline (normalized per P1 amendment) applies cleanly on
  PG18.4 with identical structural counts to PG16 and PR #250
  (125/1595/400/275/267); raw candidate hard-fails on PG18 exactly as
  on PG16, re-proving the normalize-all-opclasses amendment.
- Zero-DDL mark-as-applied, journal integrity, and replay safety proven
  end-to-end on PG18 with the real drizzle migrator; drizzle hash =
  sha256 of the shipped SQL file.
- Rollback safety: full baseline is transactional DDL on PG18 (explicit
  ROLLBACK and mid-apply failure both leave 0 objects).
- Live initDatabase() engine runs cleanly on PG18.4 (0 failures,
  pgcrypto OK, identical shape) — the app can start on PG18 today.
- Integrity: 0 invalid indexes, 0 unvalidated constraints, amcheck
  bt_index_check passes 400/400 btree indexes.
- New runbook amendment: introspected SQL ships fully block-commented
  and applies as a silent no-op (rc 0, zero objects) unless uncommented.
- P1 errata recorded (byte size 169,833; opclass token counts 437
  total / ~189 wrong). Snapshot-dependent items remain operator-gated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MMnfvQvtgNQwiUvPJ4ff8Z
mdtazizulislam added a commit that referenced this pull request Jul 8, 2026
Production Readiness P2: evidence-based PostgreSQL 18 verification,
executed on a genuine PostgreSQL 18.4 server obtained without Docker
(npm @embedded-postgres/linux-x64). Docs-only — adds
docs/audit/production-readiness/P2_PG18_VERIFICATION.md (193 lines).

- Normalized candidate baseline applies cleanly on PG18.4 with counts
  identical to PG16 and PR #250 (125/1595/400/275/267); raw candidate
  hard-fails on PG18 as on PG16, re-proving the normalize-all-opclasses
  amendment.
- Zero-DDL mark-as-applied, journal integrity, and replay safety proven
  end-to-end with the real drizzle migrator (hash = sha256 of file).
- Rollback safety: full baseline is transactional DDL on PG18.
- Live initDatabase() runs cleanly on PG18.4 (0 failures, pgcrypto OK,
  identical shape).
- Integrity: 0 invalid indexes, 0 unvalidated constraints, amcheck
  passes 400/400 btree indexes.
- New runbook amendment: introspected SQL ships block-commented and is
  a silent no-op unless uncommented (rc 0, zero objects).
- P1 errata recorded (169,833 bytes; 437 opclass tokens / ~189 wrong).
- Snapshot-dependent items remain operator-gated; no baseline adopted,
  no schema/code changes, no production deployment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants